package com.st.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.st.pojo.Student;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.annotations.Param;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Tag(name = "学生",description = "表示了插入所需要的学生信息")
public class StudentInsetPo extends Student {

    /**
     * id唯一主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    @Schema(description="id唯一主键")
    private Integer id;

    /**
     * 学生姓名
     */
    @TableField(value = "`name`")
    @Schema(description="学生姓名")
    @Length(max = 4,message = "学生姓名格式不符合规范")
    @NotNull(message = "不能为空")
    @NotBlank(message = "不能为空格")
    private String name;

    /**
     * 年龄
     */
    @TableField(value = "age")
    @Schema(description="年龄")
    @Min(value = 1,message = "输入的数不符合常理要大于0")
    @Max(value = 150,message = "输入的数不符合常理要小于150")
    @NotNull(message = "不能为空")
    private Integer age;

    /**
     * 电话号
     */
    @TableField(value = "phone")
    @Schema(description="电话号")
    @Pattern(regexp = "1[0-9]{10}",message = "不是正确的电话号")
    @NotNull(message = "不能为空")
    private String phone;

}
